/* <b>公共方法</b> 关闭弹出框 */
function closeAlt(id)
{
    $("#"+id).remove();
}

/* 获取页面之间传递的参数 
 * @param 需要页面跳转的url
 * @param 需要获取的参数key
 */
function getParam(url,key){
	
	//非空验证
	if(url==null || url=="" || key==null || key==""){
		return null;
	}
	var params=url.split("&");
	for(var i=0;i<params.length;i++){
		var param=params[i].substring(params[i].indexOf("?")+1,params[i].length);
		var ks=param.split("=");
		if(ks.length>1){
			var k=ks[0];
			if(k==key){
				return param.split("=")[1];
			}
		}else{
			return null;
		}
		
	}
	
}


/* 下一页 */
function nextPage(){
	if(Math.ceil(count/10)==page){
		return;
	}
	page=page+1;
	getData();
}
/* 上一页 */
function aogoPage(){
	if(page==1){
		return;
	}
	page=page-1;
	getData();
}
/* 首页 */
function firstPage(){
	page=1;
	getData();
}
/* 尾页 */
function bestPage(){
	page=Math.ceil(count/10);
	getData();
}

//时间转换函数
Date.prototype.format = function(format) {
    var date = {
           "M+": this.getMonth() + 1,
           "d+": this.getDate(),
           "h+": this.getHours(),
           "m+": this.getMinutes(),
           "s+": this.getSeconds(),
           "q+": Math.floor((this.getMonth() + 3) / 3),
           "S+": this.getMilliseconds()
    };
    if (/(y+)/i.test(format)) {
           format = format.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length));
    }
    for (var k in date) {
           if (new RegExp("(" + k + ")").test(format)) {
                  format = format.replace(RegExp.$1, RegExp.$1.length == 1
                         ? date[k] : ("00" + date[k]).substr(("" + date[k]).length));
           }
    }
    return format;
}

function formatDateTime(date) {  
    var y = date.getFullYear();  
    var m = date.getMonth() + 1;  
    m = m < 10 ? ('0' + m) : m;  
    var d = date.getDate();  
    d = d < 10 ? ('0' + d) : d;  
    var h = date.getHours();  
    var minute = date.getMinutes();  
    minute = minute < 10 ? ('0' + minute) : minute;  
    var result = "";
    result = h+':'+minute;
    return result;  
}; 